package cn.geminis.lowcode.compiler.code;

import cn.geminis.lowcode.compiler.util.JdkTreeMakerUtils;
import com.sun.source.tree.DoWhileLoopTree;
import lombok.RequiredArgsConstructor;

import java.util.List;

/**
 * @author puddi
 */
@RequiredArgsConstructor
public class LcDoWhile extends AbstractStatement<DoWhileLoopTree> {

    private final List<AbstractStatement<?>> body;
    private final AbstractExpression<?> condition;

    @Override
    protected DoWhileLoopTree createJdkTree() {
        return JdkTreeMakerUtils.doWhileLoop(
                new LcBlock(this.body).createJdkTree(),
                this.condition.getJdkTree()
        );
    }

}
